import store from '@/store/index.js'

const permissions = {
	verify: (code) => {
		let bool = false;
		const userInfo = store.state.userInfo;
		//const stockManage = ['stock_manager', 'inventory_manager', 'wastage_manager', 'check_manager']
		if (!userInfo) {
			bool = false;
		} else if (userInfo.isAdmin) {
			bool = true;
		} else {
			const resource = userInfo.permissionCode.split(',');
			bool = resource.includes(code)
		}
		return bool;
	}
}

export default permissions;